home *** CD-ROM | disk | FTP | other *** search
- #include "gs.h"
- #include <stdio.h>
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <intuition/cghooks.h>
- #include <intuition/classes.h>
- #include <clib/intuition_protos.h>
- #include <intuition/gadgetclass.h>
- #include <clib/utility_protos.h>
- #include "rkmmodel.h"
- #include "gxdevice.h"
- #include "gdevintui.h"
-
- intui_device gs_intui_device;
- struct IntuitionBase *IntuitionBase;
- struct UtilityBase *UtilityBase;
- struct LayersBase *LayersBase;
- extern int i_close_device(gx_device *);
- extern struct Gadget *pg_h;
- extern struct Gadget *pg_v;
- extern Object *my_rkm_model1;
- extern Object *my_rkm_model2;
- extern int i_close_device(gx_device *);
-
- void msg_loop(struct Window *);
-
- void gs_intui(void)
- {
- struct Window *w=gs_intui_device.w;
-
- if((IntuitionBase=(struct IntuitionBase *)\
- OpenLibrary("intuition.library",LIB_REV))!=NULL)
- {
- if((UtilityBase=(struct UtilityBase *)\
- OpenLibrary("utility.library",LIB_REV))!=NULL)
- {
- if((LayersBase=(struct LayersBase *)\
- OpenLibrary("layers.library",LIB_REV))!=NULL)
- {
- ModifyIDCMP(w,IDCMP_NEWSIZE|IDCMP_IDCMPUPDATE);
- /* for ever */
- for(;;) msg_loop(w);
- }
- }
- }
- }
-
- void msg_loop(struct Window *w)
- {
- struct IntuiMessage *imsg;
- static LONG old_layer_xpos=0;
- static LONG old_layer_ypos=0;
- BOOL is_rkmmod;
- int rkm_id;
- ULONG val;
- struct TagItem *ti;
- struct TagItem *tstate;
- struct RastPort *rp=gs_intui_device.rp;
-
- WaitPort(w->UserPort);
- while((imsg=(struct IntuiMessage *)GetMsg(w->UserPort))!=NULL)
- {
- switch(imsg->Class)
- {
- case IDCMP_NEWSIZE:
- SetGadgetAttrs(pg_h,w,NULL,\
- PGA_Visible,w->GZZWidth/SCROLL_UNIT,
- TAG_END);
- SetGadgetAttrs(pg_v,w,NULL,\
- PGA_Visible,w->GZZHeight/SCROLL_UNIT,\
- TAG_END);
- SetAttrs(my_rkm_model1,RKMMOD_Limit,(gs_intui_device.width-
- w->GZZWidth)/SCROLL_UNIT);
- SetAttrs(my_rkm_model2,RKMMOD_Limit,(gs_intui_device.height-
-
- w->GZZHeight)/SCROLL_UNIT);
- WaitBlit();
- SyncSBitMap(rp->Layer);
- CopySBitMap(rp->Layer);
- break;
- case IDCMP_IDCMPUPDATE:
- tstate=ti=(struct TagItem *)imsg->IAddress;
- is_rkmmod=FALSE;
- rkm_id=-1;
- while((ti=NextTagItem(&tstate))!=NULL)
- {
- switch(ti->ti_Tag)
- {
- case RKMMOD_Id:
- is_rkmmod=TRUE;
- rkm_id=ti->ti_Data;
- break;
- case RKMMOD_CurrVal:
- val=ti->ti_Data;
- break;
- }
- }
- if(is_rkmmod)
- {
- switch(rkm_id)
- {
- case 0:
- ScrollLayer(0,rp->Layer,\
- ((LONG)val-old_layer_xpos)*SCROLL_UNIT,0);
- old_layer_xpos=val;
- break;
- case 1:
- ScrollLayer(0,rp->Layer,0,\
- ((LONG)val-old_layer_ypos)*SCROLL_UNIT);
- old_layer_ypos=val;
- break;
- default:
- }
- }
- }
- ReplyMsg((struct Messsage *)imsg);
- }
- }
-
-